package com.hyl.controller;

import com.hyl.entity.SysUser;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpSession;

/**
 * @Description TODO
 * @Author com.hyl
 * @Date 2022/10/15 9:32
 **/
@Controller
public class LoginController {

	Logger logger = Logger.getLogger(LoginController.class);

	@RequestMapping("/login")
	public String login(@RequestParam(defaultValue = "admin") String account,
	                    @RequestParam(defaultValue = "123456") String password,
	                    HttpSession session){


		SysUser tmp = new SysUser(); //数据库
		tmp.setAccount(account);
		tmp.setRealName("com.hyl");

		session.setAttribute("userSession",tmp);
		logger.info("登入");

		return "main";
	}
}
